<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	
</body>
<script type="text/javascript">
	// 数值(Number) 字符串(String) 布尔(Boolean) 空(null) 未定义(undefined)
	// 1、转数值
	console.log(Number("23"));  //23
	console.log(Number("4.6")); //4.6
	console.log(Number("23e")); //NaN
	console.log(Number(false)); //0
	console.log(Number(true));  //1
	console.log(Number(null));  //0
	console.log(Number(undefined)); //NaN
	// 2、字符串
	console.log(String(34));
	console.log(String(true));
	console.log(String(false));
	console.log(String(undefined));
	console.log(String(null));
	console.log(String(NaN));
	// 3、布尔
	console.log(Boolean(123));  //true
	console.log(Boolean(0));	//false
	console.log(Boolean(-45));	//true
	console.log(Boolean("undefined"));	//true
	console.log(Boolean("null"));	//true
	console.log(Boolean(""));	//false
	console.log(Boolean(" "));	//true
	console.log(Boolean(undefined));//false
	console.log(Boolean(null));	//false
	console.log(Boolean(NaN));	//false
	// 隐式转换
	console.log(3 + true);	//4
	console.log(3 - true);	//2
	console.log("5" + 6);	//56
	console.log("5" - 2);	//3
	console.log(+"45");		//45
	console.log(-"45");		//-45
	console.log(5 + NaN);	//NaN
	console.log("12" - true);	//11
	console.log("12" + false);	//12false
	console.log(3 + undefined);	//NaN
	// 如何判断Number转化过来的数字是不是NaN
	var a = "123N";
	if (isNaN(Number(a))) {
		document.body.innerHTML = 10;
	} else {
		document.body.innerHTML = Number(a) + 10;
	}
</script>
</html>